package org.springframework.example.aop;

import org.springframework.aop.framework.ProxyFactory;
import org.springframework.example.aop.advice.MyAfterRuturnAdvice;
import org.springframework.example.aop.advice.MyAroundAdvice;
import org.springframework.example.aop.advice.MyBeforeAdvice;
import org.springframework.example.aop.advice.MyThrowsAdvice;
import org.springframework.example.aop.service.AccountService;

public class Test2 {

	public static void main(String[] args) {
		AccountService target = new AccountService();

		ProxyFactory proxyFactory = new ProxyFactory();
		proxyFactory.setTarget(target);
		proxyFactory.addAdvice(new MyBeforeAdvice());
		proxyFactory.addAdvice(new MyAfterRuturnAdvice());
		proxyFactory.addAdvice(new MyThrowsAdvice());
		proxyFactory.addAdvice(new MyAroundAdvice());
		AccountService proxy = (AccountService) proxyFactory.getProxy();
		proxy.test2(333);
		System.out.println(333);


	}
}
